<template>
<div id="root">
    <div>
        <a href="/child-web1/index.html/#/home">web1-index.html</a> |
        <a href="/child-web1/book.html/#/home">web1-book.html</a> |
        <a href="/child-web2/index.html/#/home">web2-index.html</a> |
        <a href="/child-web2/user.html/#/home">web2-user.html</a> |
    </div>
    <div>
        <button @click="sendMes1">点击向子应用发送消息1</button>
        <button @click="sendMes2">点击向子应用发送消息2</button>
    </div>
    <hr>
    <div id='qiankun-root'></div>
    <!-- <div v-show="content" v-html="content"></div>
    <router-view v-show="!content"/> -->
</div>
</template>
<script>
import actions from '@/actions/actions'
console.log('actions:', actions);
export default {
    name: 'root',
    props: {
        loading: Boolean,
        content: String
    },
    data() {
        return {
          mes1: { username: '项目1' },
          mes2: { username: '项目2' },
        }
      },
    methods: {
        sendMes1() {
            actions.setGlobalState({
                type: 'setGloLoginUser',
                value: this.mes1,
            });//通过setGlobalState改变全局状态
        },
        sendMes2() {
            actions.setGlobalState({
                type: 'setGloLoginUser',
                value: this.mes2,
            });//通过setGlobalState改变全局状态
        }

      },
}
</script>
<style lang="scss">
#root {
    font-family: Avenir, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: center;
    color: #2c3e50;
}
</style>
